// 数值递增函数
export const readuceNumFn = (min, max, list, num = 1) => {
  list.push(min)
  let count = min
  if (count < max) {
    count = min + num
    readuceNumFn(count, max, list)
  } else {
    count = max
  }
  return list
}

// 手机号加密
export const hidePhoneFn = phone => {
  var reg = /(\d{3})\d{4}(\d{4})/
  return phone?.replace(reg, '$1****$2')
}

// 指定文字变色
export const textColorFn = text => {
  if (text) {
    const floatRegex = /[-+]?([0-9]*\.[0-9]+|[0-9]+\.[0-9]*|[0-9]+)/g
    const strArr = text.match(floatRegex)

    strArr?.forEach(v => {
      text = text.replace(v, `<span class="t-color">${v}</span>`)
    })
  }
  return text
}
